home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Amos / SupraProcs / WashBob.AMOS / WashBob.amosSourceCode
Encoding:
AMOS Source Code  |  1996-01-26  |  2.4 KB  |  69 lines

  1. '   AMOSPRO
  2. '
  3. '   ******************************************************** 
  4. '   ***                                                  *** 
  5. '   ***                 Wash Bob Procedure               *** 
  6. '   ***                                                  *** 
  7. '   ***                        by                        *** 
  8. '   ***                                                  *** 
  9. '   ***                   Joseph Bolin                   *** 
  10. '   ***                                                  *** 
  11. '   ******************************************************** 
  12.  
  13. For Y=0 To 15
  14.    Ink Y : Bar 0,Y*8 To 127,Y*8+7
  15. Next 
  16. Get Icon 1,0,0 To 128,128
  17. For C=0 To 15
  18.    _WASHBOB[-1,C,2]
  19.    Paste Icon 160,0,1
  20. Next 
  21.  
  22. Procedure _WASHBOB[_BOB,_COLOR,_CHANGE]
  23.  
  24.    ' Inputs:  _BOB     Bob to change the color of --- Negative numbers signify icons
  25.    '          _COLOR   Color to change
  26.    '          _CHANGE  Color to change it to  
  27.    '
  28.    ' Outputs: Washes one color of a bob to another color
  29.  
  30.    If _BOB>=0 Then SBASE=Sprite Base(_BOB) Else SBASE=Icon Base(-_BOB)
  31.    _TEMP=Length(1)+1
  32.    If SBASE=0 and _BOB>0 Then Error 68
  33.    If SBASE=0 and _BOB<0 Then Error 74
  34.    XSZ=Deek(SBASE)*16 : YSZ=Deek(SBASE+2) : NPLANES=Deek(SBASE+4)
  35.    FLAG=1
  36.    SCR=Screen
  37.    NC=1
  38.    Rol.w NPLANES,NC
  39.    For SC=0 To 7
  40.       Trap Screen SC : If Errtrap<>0 : Screen Open SC,XSZ,YSZ*2,NC,Lowres : Screen Hide : Exit : End If 
  41.    Next 
  42.    If SC=8 : Error 47 : End If : Rem *** no available screens!! *** 
  43.    ST=SBASE+10 : SZ=XSZ/8*YSZ
  44.    Cls 1 : Get Bob _TEMP,0,0 To XSZ,YSZ : SBASE2=Sprite Base(_TEMP)
  45.    AD=SBASE+10 : No Mask _TEMP : CL=1
  46.    For PL=0 To NPLANES-1
  47.       Copy AD,AD+SZ To SBASE2+10 : Paste Bob 0,0,_TEMP
  48.       If CL and _COLOR Then Screen Copy SC,0,0,XSZ,YSZ To SC,0,YSZ,%10000000
  49.       If(CL and _COLOR)=0 Then Screen Copy SC,0,0,XSZ,YSZ To SC,0,YSZ,%100000
  50.       CL=CL*2 : Add AD,SZ
  51.    Next 
  52.    Get Bob _TEMP,0,YSZ To XSZ,YSZ*2
  53.    SBASE2=Sprite Base(_TEMP)+10 : AD=SBASE2+SZ
  54.    If NPLANES=1 Then Goto SKIP
  55.    CL=2
  56.    For PL=1 To NPLANES-1
  57.       If CL and _CHANGE Then Copy SBASE2,SBASE2+SZ To AD
  58.       If(CL and _CHANGE)=0 Then Fill AD To AD+SZ,0
  59.       Add AD,SZ : CL=CL*2
  60.    Next 
  61.    If(_CHANGE and 1)=0 Then Fill SBASE2 To SBASE2+SZ,0
  62.    SKIP:
  63.    Cls 0 : If _BOB>0 Then Paste Bob 0,0,_BOB Else Paste Icon 0,0,-_BOB
  64.    Paste Bob 0,0,_TEMP
  65.    If _BOB>0 Then Get Bob _BOB,0,0 To XSZ,YSZ Else Get Icon -_BOB,0,0 To XSZ,YSZ
  66.    Screen Close Screen
  67.    Screen SCR
  68.    Del Bob _TEMP
  69. End Proc